<?php

use think\migration\Migrator;
use Phinx\Db\Adapter\MysqlAdapter;

class CreateNodesPortTable extends Migrator
{
    /**
     * Migrate Up.
     */
    public function up()
    {
        $this->table('nodes_port', ['comment' => '节点已用端口表', 'id' => 'id', 'primary_key' => ['id']])
            ->addColumn('nid', 'integer', ['limit' => 11, 'default' => 0, 'comment' => '节点id'])
            ->addColumn('port', 'string', ['limit' => 10, 'default' => '', 'comment' => '端口'])
            ->addIndex('nid')
            ->create();
    }

    /**
     * Migrate Down.
     */
    public function down()
    {
        $this->dropTable('nodes_port');
    }
}
